package com.leetcode;

/**
 * TODO
 *
 * @author lefly
 * @version 1.0
 * @classname No136
 * @description 136. 只出现一次的数字
 * @date 2021/3/11 上午11:15
 */
public class No136 {
    public static void main(String[] args) {
        int[] data = {4,1,2,1,2};
        int singleNum = singleNumber(data);
        System.out.println(singleNum);

    }

    public static int singleNumber(int[] nums) {
        int res = 0;
        for (int num:nums){
            res ^= num;
        }
        return res;

    }

}
